use std::io;

use djon::Value;

fn main() -> io::Result<()> {
    let mut buf = [0u8; 512];

    let len = djon::compound!(
        Value::ident("barfoo"),
        Value::boolean(false),
        Value::integer(2333),
        Value::real(3.14159),
        Value::string("World, Hello?"),
        Value::pair(Value::ident("Kay"), Value::string("Valve")),
        Value::Nil
    )
    .write_bin(&mut buf.as_mut_slice())?;

    let len = Value::bytes(&buf[..len]).write_bin(&mut buf.as_mut_slice())?;

    for i in 0..len {
        print!("{} ", buf[i]);
        if i & 7 == 7 {
            println!()
        }
    }
    println!();
    
    Ok(())
}
